<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>axios基本运用</title>
</head>
<body>

    <input type="button" value="get请求" class="get">
    <input type="button" value="post请求" class="post">
     <!-- 官网提供的 axios 在线地址 -->
     <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        // get请求
        document.querySelector(".get").onclick=function(){
            axios.get("https://autumnfish.cn/api/joke/list1424?num=10")
            .then(function(response){
                console.log(response);
            },function(err){
                console.log(err);
            })      
        }
        //  post请求
        document.querySelector(".post").onclick=function(){
            axios.post("https://autumnfish.cn/5325325api/user/reg",
            {username:"xiaodd"})
            .then(function(response){
                console.log(response);
            },function(err){
                console.log(err);
            })
        }
        
    </script>
</body>
</html>